#!/bin/sh

bin="/usr/local/app/tars/tarsnode/bin/tarsnode"

while :
do
PID=`ps -eopid,cmd | grep "$bin" | grep "tarsnode" | grep -v "grep" | grep -v "sh" | awk '{print $1}'`

#echo $PID
if [ "$PID" = "" ]; then
    echo "Starting service..."
    /bin/sh /usr/local/app/tars/tarsnode/util/start.sh
fi
sleep 10
done
